// 公共主页
<template>
  <div class="application-container no-header">
    <header>
      <div class="left">
        <i class="home" @click="goHome" v-if="showHome"></i>
        <i class="back"  @click="back" v-if="showBack"></i>
      </div>
      <div  class="center">{{ title }}</div>
      <div class="right"><i class="add" @click="$emit('newEvent')" v-if="showNew"></i></div>
    </header>
    <main>
      <slot/>
    </main>
  </div>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      require: true,
    },
    // 回到首页按钮
    showHome: {
      type: Boolean,
      default: true,
    },
    // 返回上一页按钮
    showBack: {
      type: Boolean,
      default: false,
    },
    // 返回添加按钮
    showNew: {
      type: Boolean,
      default:false, 
    },
  },
  methods:{
    goHome(){
      this.$router.push('/home')
    },
    back(){
    this.$router.go(-1)
    }
  }
};
</script>
